/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var xmlHttp;
function ajaxAddToCart(id, name, desc, price){
    var URL = "../cart/add_cart.html?product.id=" + id + "&product.name=" + name + "&product.description=" + desc + "&product.price=" + price;
    try{
        xmlHttp = new XMLHttpRequest();
    }catch(e){
        try{
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){
                alert("your browser does not support AJAX!");
                return false;
            }
        }
    }

    xmlHttp.onreadystatechange = updateNumberItems;

    xmlHttp.open("GET", URL, true);

    xmlHttp.send(null);
}

function updateNumberItems(){
    if(xmlHttp.readyState == 4){
        document.getElementById('numberCartItems').innerHTML = xmlHttp.responseText;
    }
}
